package com.example.soss.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.soss.entity.Course;
import org.apache.ibatis.annotations.Insert;

public interface CourseMapper extends BaseMapper<Course> {

    //库存大于0才减库存
    @Insert("update t_course set amount = amount - 1 where amount > 0 and id = #{courseId}")
    int updateCourse(int courseId);
}
